package com.zxlspace.design.pattern.singleton;

import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class Test {

    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
        Thread t1 = new Thread(new T());
        Thread t2 = new Thread(new T());

        t1.start();
        t2.start();

//        A a = new A();
//        System.out.println(a);


//        HungrySingleton instance = HungrySingleton.getInstance();
//        Class clazz = HungrySingleton.class;
//        Constructor constructor = clazz.getDeclaredConstructor();
//        Class clazz = StaticInnerClassSingleton.class;
//        Class clazz = EnumInstance.class;
//        Constructor constructor = clazz.getDeclaredConstructor();
//        constructor.setAccessible(true);
//        HungrySingleton newInstance = (HungrySingleton) constructor.newInstance();
//        StaticInnerClassSingleton newInstance = (StaticInnerClassSingleton) constructor.newInstance();
//        EnumInstance newInstance = (EnumInstance) constructor.newInstance();

//        StaticInnerClassSingleton instance = StaticInnerClassSingleton.getInstance();
//        EnumInstance instance = EnumInstance.

        Map<String, Object> map = new ConcurrentHashMap<>();

//        System.out.println(instance);
//        System.out.println(newInstance);
//        System.out.println(newInstance == instance);
    }
}
